home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_MacPaint / Source / shared.subproj / ConvertController.h < prev    next >
Text File  |  1995-06-12  |  5KB  |  158 lines

  1. /***********************************************************************\
  2. Common class for subclass Controller in all Convert programs
  3. Copyright (C) 1993 David John Burrowes
  4.  
  5. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version.
  6.  
  7. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  8.  
  9. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  10.  
  11. The author, David John Burrowes, can be reached at:
  12.     davidjohn@kira.net.netcom.com
  13.     David John Burrowes
  14.     1926 Ivy #10
  15.     San Mateo, CA 94403-1367
  16. \***********************************************************************/
  17.  
  18. #import "ResultObject.h"
  19. #import "common.h"
  20. #import "ProgressIndicator.h"
  21. // NSmajor defined in  common.
  22. #if (NSmajor == 2)
  23. #    import <appkit/defaults.h>
  24. #else
  25. #    import <defaults/defaults.h>
  26. #endif
  27.  
  28. @interface ConvertController:ResultObject
  29. {
  30.     id    ProgressWindow;        // Window where our progress will be displayed
  31.     id    SourceFileName;    // object where name of paint file being convertes is shown
  32.     id    DestFileName;  // object which deals with displaying the name of the EPS file
  33.     id    Status;        // object which deals with displaying status info (e.g. errors)
  34.     id    DestPath;
  35.     id    SourcePath;
  36.     id    ProgressMeter;
  37.     id    SourceTitle;
  38.     id    SourcePathTitle;
  39.     id    DestTitle;
  40.     id    DestPathTitle;
  41.     id    StatusTitle;
  42.     id    prefPanel;        // the panel which displays the preferences values for the user
  43.     id    listener;            // The listener instance that we use for receiving docs from wkspce
  44.     id    decisionWindow;
  45.     id    decisionText;        //    The text of why the file was judged imperfect.
  46.     id    converterInst;
  47.     //
  48.     //    Menus cells.  So we can dim them at the right times
  49.     //
  50.     id    quitCommand;
  51.     id    hideCommand;
  52.     id    infoCommands;
  53.     id    editCommands;
  54.     id    servicesCommands;
  55.     id    windowsCommands;
  56.     //
  57.     //    These are all enabled only when file dialogs are up.  That's the only time the user
  58.     //    should be wanting to modify text.
  59.     //
  60.     id    cutCommand;
  61.     id    pasteCommand;
  62.     id    spellingCommand;
  63.     id    checkSpellingCommand;
  64.  
  65.  
  66.  
  67.     CString    ConversionString;
  68.     CString    SourcePrompt, DestPrompt, DestExtension, DefaultsOwner;
  69.     CString    SourceExtension; // Unused at the moment
  70.     CString    filePaths;        //    A string of files that are being dragged-and-dropped
  71.     CString    AppHome;
  72.     
  73.     Real            lastPercent;    //    Stores the last percentage we had for the progress meter
  74.     Boolean        cancelResult;    //    Indicates what decision the user made (whether to continue the conversion or cancel it
  75.     Boolean        destIsDead;    // An ugly hack.  For when converter has closed the dest file.
  76. }
  77.  
  78.  
  79. //
  80. //    For delegate responsibilities
  81. //
  82. - appWillInit: sender;
  83. - appDidInit: sender;
  84. - appWillTerminate: sender;
  85. - (BOOL) appAcceptsAnotherFile:sender;
  86. - (int)app:sender openFile:(const char *)filename type:(const char *)aType;
  87. //
  88. //    For speaker-listener delgation stuff (drag and drop)
  89. //
  90. - (int)iconEntered:(int)windowNum at:(double)x :(double)y
  91.     iconWindow:(int)iconWindowNum iconX:(double)iconX iconY:(double)iconY
  92.     iconWidth:(double)iconWidth iconHeight:(double)iconHeight
  93.     pathList:(char *)pathList;
  94. - (int)iconReleasedAt:(double)x :(double)y ok:(int *)flag;
  95. - (int)iconExitedAt:(double)x :(double)y;
  96. #if (NSmajor == 3)
  97. //
  98. //    For NS 3.0 drag and drop stuff
  99. //
  100. - (NXDragOperation)draggingEntered:(id)sender;
  101. - (NXDragOperation)draggingUpdated:(id)sender;
  102. - (BOOL)prepareForDragOperation:(id)sender;
  103.  - (BOOL)performDragOperation:(id)sender;
  104. - concludeDragOperation:(id)sender;
  105. - draggingExited:(id)sender;
  106. #endif
  107. //
  108. //    Utilities for the above
  109. //
  110. - allowDragAndDrop;
  111. - refuseDragAndDrop;
  112. - ProcessDroppedFiles;        // behaves at much the same layer as PrepareForConversion, below.
  113. //
  114. //    Methods to support simple converter-as-slave dialog.
  115. //
  116. - (int)msgQuit:(int *)flag;
  117. - msgConvert: (char *) sourceFile  To: (char*) destFile;
  118. //
  119. //    the main guts of the class...
  120. //
  121. - init;        // Override this in subclasses. (must open convertInst convert instance)
  122. -free;
  123.  
  124. - displayPreferences: sender;        // Override this in subclasses (if one has prefs to disply)
  125. - (CString) GetPref: (ConstCString) thePreference;
  126. - SetPref: (ConstCString) thePreference To: (CString) value;
  127. - SetBoolPref: (ConstCString) thePreference To: (Boolean) value;
  128. - (Boolean) GetBoolPref: (ConstCString) thePreference;
  129.  
  130. - SetPercentageDone: (Real) percentage;
  131.  
  132. - openDestFile: (roCString) theFile;        // Override these in sub. if need to open non File files
  133. - openSourceFile: (roCString) theFile;    // Unlike others, Do NOT call [super...]
  134. - closeSourceFile: fileInstance;            // if overrode above, then override these
  135. - closeDestFile: fileInstance  andDelete: (Boolean) deleteit;  // also don't [super ...]
  136.  
  137. - preConversion;        // might want to subclass these (but no more likely not)
  138. - postConversion;
  139.  
  140. - (Boolean) CheckFileOK: fileInst;
  141. - UserDecided: sender;
  142.  
  143. - PrepareForConversion: sender;
  144. - ConvertThisFile: (roCString) theFile;
  145. - DoConversionFrom: sourceFile  To: destinationFile;
  146. - ConvertFrom: sourceFile To: destinationFile;  // Must override
  147. @end
  148.  
  149.  
  150.  
  151. //
  152. //    Errors:
  153. //
  154. #define    ERR_USERABORTED             10001
  155. #define    ERR_TRIEDTOOVERWRITE    10002
  156. #define    ERR_CREATEFAILED        10003
  157. #define    ERR_OPENFAILED            10004
  158.